﻿
using MediatR;
using SystemMHB.API.Application.Command.SupplierCommand;
using SystemMHB.Domian;
using SystemMHB.Infrstructer.Interface;

namespace SystemMHB.API.Application.CommandHandlers.SupplierCommandHandlers
{
    public class SupplierFanCommandHandler : IRequestHandler<SupplierFanCommand, Supplier>
    {
        /// <summary>
        /// 供应商仓储接口
        /// </summary>
        ISupplierRepository supRep;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="supRep">供应商仓储接口</param>
        public SupplierFanCommandHandler(ISupplierRepository supRep)
        {
            this.supRep = supRep;
        }

        public async Task<Supplier> Handle(SupplierFanCommand request, CancellationToken cancellationToken)
        {
            return await supRep.GetModelAsync(request.supplierID);
        }
    }
}
